package com.wang.chatai.entity.vo;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.ai.chat.messages.Message;

/**
 * 会话历史信息实体类
 */
@Data
@NoArgsConstructor
public class MessageVO {

    private String role;

    private String content;

    //会话的历史信息存放在Message类中
    public MessageVO(Message message) {
        //会话历史类型
        switch (message.getMessageType()) {
            case USER:
                role = "user";
                break;
            case ASSISTANT:
                role = "assistant";
                break;
            default:
                role = "";
                break;
        }
        //会话历史文本
        this.content = message.getText();
    }

}
